#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>

#define LOG "log.txt"
#define LOG_NORMAL "logNormal.txt"
#define LOG_ERROR "logError.txt"
int main()
{
    //close(1);
    //open(LOG_NORMAL, O_WRONLY | O_CREAT | O_APPEND, 0666);
    //close(2);
    //open(LOG_ERROR, O_WRONLY | O_CREAT | O_APPEND, 0666);
    //printf("hello printf->stdout\n");
    //printf("hello printf->stdout\n");
    fprintf(stdout, "hello fprintf->stdout\n");
    fprintf(stdout, "hello fprintf->stdout\n");
    fprintf(stdout, "hello fprintf->stdout\n");
    fprintf(stdout, "hello fprintf->stdout\n");
    fprintf(stdout, "hello fprintf->stdout\n");
    fprintf(stderr, "hello fprintf->stderr\n");
    fprintf(stderr, "hello fprintf->stderr\n");
    fprintf(stderr, "hello fprintf->stderr\n");
    fprintf(stderr, "hello fprintf->stderr\n");
    fprintf(stderr, "hello fprintf->stderr\n");
    fprintf(stderr, "hello fprintf->stderr\n");
    //fclose(stdin);
    //close(2);
    //int fd1 = open(LOG, O_WRONLY | O_CREAT | O_TRUNC, 0666);
    //int fd2 = open(LOG, O_WRONLY | O_CREAT | O_TRUNC, 0666);
    //int fd3 = open(LOG, O_WRONLY | O_CREAT | O_TRUNC, 0666);
    //int fd4 = open(LOG, O_WRONLY | O_CREAT | O_TRUNC, 0666);
    //int fd5 = open(LOG, O_WRONLY | O_CREAT | O_TRUNC, 0666);
    //int fd6 = open(LOG, O_WRONLY | O_CREAT | O_TRUNC, 0666);
    //printf("%d\n", fd1);
    //printf("%d\n", fd2);
    //printf("%d\n", fd3);
    //printf("%d\n", fd4);
    //printf("%d\n", fd5);
    //printf("%d\n", fd6);
    //printf("%d\n", stdin->_fileno);
    //printf("%d\n", stdout->_fileno);
    //printf("%d\n", stderr->_fileno);
    //FILE* fp = fopen(LOG, "w");
    //printf("%d\n", fp->_fileno);
    //int fd = open(LOG, O_WRONLY | O_CREAT | O_TRUNC, 0666);
    //if (fd < 0) printf("fd:%d, errno:%d, %s\n", fd, errno, strerror(errno));
    //else printf("fd:%d, errno:%d, %s\n", fd, errno, strerror(errno));
    //const char* buf = "aaa";
    //write(fd, buf, sizeof(buf));
    //close(fd);
    return 0;
}
